<template>
	<div class="container">
		<el-table v-loading="dataset.loading" :data="dataset.items"  class="el-mb-15" stripe>
			<el-table-column prop="ordernumber" label="订单号" />
			<el-table-column prop="username" label="下单人" />
			<el-table-column prop="znumber" label="总重量(KG)" />
			<el-table-column prop="price" label="总价格" />
			<el-table-column prop="create_time" label="下单时间" />
			 <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
      </template>
    </el-table-column>
		</el-table>
		<!-- <el-pagination @size-change="eventUpdateRequestLimit" @current-change="controllerRequestListDataset" :current-page="dataset.page" :page-size="dataset.limit" :total="dataset.total" :page-sizes="[10, 50, 100, 200, 300]" layout="total, sizes, prev, pager, next, jumper" /> -->
	</div>
</template>

<script>
	import {
		Table, TableColumn, Pagination,
		Button, Select, Option,
		Drawer, Dialog,
		MessageBox, Message
	} from 'element-ui';

	export default {
		components: {
			[Table.name]: Table, [TableColumn.name]: TableColumn, [Pagination.name]: Pagination,
			[Button.name]: Button, [Select.name]: Select, [Option.name]: Option,
			[Drawer.name]: Drawer, [Dialog.name]: Dialog,
		},
		data() {
			return {
				dataset: {
					loading: false,
					total: 0, limit: 10, page: 1,
					items: []
				}
			}
		},
		mounted() {
			this.controllerRequestListDataset();
		},
		methods: {
			controllerRequestListDataset(page) {
				if (this.dataset.loading) return; else this.dataset.loading = true;
				if (page) this.dataset.page = page;

				var url = '/api/admin/order/getlist',
					params = {
                        page: this.dataset.page - 1, list_rows: this.dataset.limit, type: "allin",
						token: this.$store.state.options.user.token,
						utype:3
					};

				this.$util.postRequestInterface(url, params, {
					success: (res) => {
						// console.log(res)
                        this.dataset.total = res.data.count;
						this.dataset.items = res.data.data.map((data, index, arr) => {
                            data.create_time = this.$moment(parseInt(data.create_time) * 1000).format('YYYY-MM-DD HH:mm:ss');
                            return data;
                        });
					},
					complete: (e) => {
						this.dataset.loading = false;
					}
				});
			},
			handleClick(a){
				// console.log(a)
				this.$router.push({
					path:"/stock-manage/details",
					query:{
						id:a.id
						
					}
				})
			},
			eventUpdateRequestLimit(limit) {
				if (this.dataset.loading) return;

				this.dataset.limit = limit;
				this.dataset.page = 1;
				this.dataset.total = 0;

				this.controllerRequestListDataset();
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>
